package vfc.model.valueObjects
{

	[Bindable]
	[RemoteClass(alias="vfc.model.valueObjects.Site")]
	public class Site
	{
		public var id:int;
		public var siteID:int;
		public var name:String;
		public var streetNumber:String;
		public var streetName:String;
		public var area:Area;
		public var crossStreet:String;
		public var contact1:Contact;
		public var contact2:Contact;
		public var contactPhone2:String;
		public var fax:String;
		public var notes:String;
		public var activityFax:Boolean;
		public var services:Array = new Array();

		public function get address():String{
			return streetNumber + " " + streetName + ", " + area.city + ", " + area.state + ", " + area.zip
		}

		public function toHTMLString():String
		{
			var toString:String = '<b><font size="16">'+name+'</font></b><br/>';
			
			toString += '<b>Address:</b> '
				+ streetNumber
				+ ' '
				+ streetName
				+ ', '
				+ ((area) ? (area.city + ', ') : '')
				+ ((area) ? (area.state + ' ') : '')
				+ ((area) ? area.zip : '')
				+ '<br/>';

			if (crossStreet != null && crossStreet != "") {
				toString += '<b>Cross street:</b> '+crossStreet+'<br/>';
			}
			
			if(contact1 && contact1.phone != null && contact1.phone != "") {
				toString += '<b>Phone:</b> '+contact1.phone+'<br/>';
			}
			
			if(fax != null && fax != "") {
				toString += '<b>Fax:</b> '+fax+'<br/>';
			}
			
			if(notes != null && notes != "") {
				toString += '<b>Additional information:</b> '+notes;
			}
			
			return toString;
		}

		public function toHTMLStringScreen():String
		{
			var toString:String = 	'<b><font size="16">' +
									name +
									'</font></b><br/><br/>';

				toString += '<b>Address:</b> ' +
							streetNumber +
							' ' +
							streetName +
							', ' +
							area.city +
							', ' +
							area.state +
							' ' +
							area.zip +
							'<br/><br/>';

			if(crossStreet != null && crossStreet != "")
			{
				toString += '<b>Cross street:</b> '+crossStreet+'<br/><br/>';
			}

			if(contact1 != null && contact1.phone != null && contact1.phone != "")
			{
				toString += '<b>Phone:</b> '+contact1.phone+'<br/><br/>';
			}

			if(fax != null && fax != "")
			{
				toString += '<b>Fax:</b> '+fax+'<br/><br/>';
			}

			if(notes != null && notes != "")
			{
				toString += '<b>Additional information:</b> '+notes;
			}

			return toString;
		}
	}
}